From 1b32d9116a6b61d32df6f4ab48e5e535e8b106c0 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Tue, 5 May 2015 11:57:37 +0200 Subject: [PATCH] Implemented "Save drafts" --- doc/config.html | 18 +++++++++++++----- src/elogd.c | 12 ++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/doc/config.html b/doc/config.html index 9848f587..d1527b0e 100755 --- a/doc/config.html +++ b/doc/config.html @@ -2710,13 +2710,21 @@ Options Location = Main Building{a}, New Building{b}, Old Building{c} selecting a certain time period. Following options are possible: 0, 1, 3, 7, 31, 92, 182, 364. "0" means an unrestricted search default. +
  • + Save drafts = 0|1
    + Starting with version 3.1, ELOG supports auto saving. When text for a new + entry is entered in the browser, it might get lost if the browser windows is + closed before the entry has been submitted. In order to avoid this, entries + can be saved as drafts, to be finished and submitted later. This can be + achieved by clicking on the Save button or by the + autosave feature (see next option). The Save drafts + option turns this feature on or off. Default is 1. +
  • Autosave = <seconds>
    - Starting with version 3.1, ELOG supports auto saving. When text for a new - entry is entered in the browser, it might get lost if the browser windows is - closed before the entry has been submitted. In order to avoid this, the text - is sent the the server regularly (default is ten seconds after the last edit). - This time interval can be controlled with this setting. Setting Autosave to + Drafts can be sent to the server regularly after some editing (see previous + option). This option determines the interval this is done. The default is + 10 seconds after the last edit. Setting Autosave to zero disables the autosave functionality.
  • diff --git a/src/elogd.c b/src/elogd.c index 68eed11f..d11a0224 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -10204,6 +10204,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL autosave = atoi(str); else autosave = 10; + + if (getcfg(lbs->name, "Save drafts", str, sizeof(str)) || atoi(str) == 0) + autosave = 0; rsprintf("function mod(e)\n"); rsprintf("{\n"); @@ -10433,12 +10436,15 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL rsprintf("\n", loc("Submit")); - rsprintf("\n", + + if (!getcfg(lbs->name, "Save drafts", str, sizeof(str)) || atoi(str) == 1) + rsprintf("\n", loc("Save")); if (!getcfg(lbs->name, "Show text", str, sizeof(str)) || atoi(str) == 1) rsprintf("\n", loc("Preview")); + rsprintf("\n", loc("Back")); @@ -11948,7 +11954,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL rsprintf("\n"); rsprintf("\n", loc("Submit")); - rsprintf("\n", + + if (!getcfg(lbs->name, "Save drafts", str, sizeof(str)) || atoi(str) == 1) + rsprintf("\n", loc("Save")); if (!getcfg(lbs->name, "Show text", str, sizeof(str)) || atoi(str) == 1)