Implemented "Save drafts"

This commit is contained in:
Stefan Ritt 2015-05-05 11:57:37 +02:00
parent 6baf4ff845
commit 1b32d9116a
2 changed files with 23 additions and 7 deletions

View File

@ -2711,12 +2711,20 @@ Options Location = Main Building{a}, New Building{b}, Old Building{c}
7, 31, 92, 182, 364</b>. "0" means an unrestricted search default. 7, 31, 92, 182, 364</b>. "0" means an unrestricted search default.
</li> </li>
<li> <li>
<b><code>Autosave = &lt;seconds&gt;</code></b><br> <b><code>Save drafts = 0|1</code></b><br>
Starting with version 3.1, ELOG supports auto saving. When text for a new 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 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 closed before the entry has been submitted. In order to avoid this, entries
is sent the the server regularly (default is ten seconds after the last edit). can be saved as drafts, to be finished and submitted later. This can be
This time interval can be controlled with this setting. Setting Autosave to achieved by clicking on the <b><code>Save</code></b> button or by the
<i>autosave</i> feature (see next option). The <b><code>Save drafts</code></b>
option turns this feature on or off. Default is <b><code>1</code></b>.
</li>
<li>
<b><code>Autosave = &lt;seconds&gt;</code></b><br>
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
<b><code>10</code></b> seconds after the last edit. Setting Autosave to
zero disables the autosave functionality. zero disables the autosave functionality.
</li> </li>
</ul> </ul>

View File

@ -10205,6 +10205,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
else else
autosave = 10; autosave = 10;
if (getcfg(lbs->name, "Save drafts", str, sizeof(str)) || atoi(str) == 0)
autosave = 0;
rsprintf("function mod(e)\n"); rsprintf("function mod(e)\n");
rsprintf("{\n"); rsprintf("{\n");
if (autosave) { if (autosave) {
@ -10433,12 +10436,15 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return chkform();\">\n", rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return chkform();\">\n",
loc("Submit")); loc("Submit"));
if (!getcfg(lbs->name, "Save drafts", str, sizeof(str)) || atoi(str) == 1)
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return save_draft();\">\n", rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return save_draft();\">\n",
loc("Save")); loc("Save"));
if (!getcfg(lbs->name, "Show text", str, sizeof(str)) || atoi(str) == 1) if (!getcfg(lbs->name, "Show text", str, sizeof(str)) || atoi(str) == 1)
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return mark_submitted();\">\n", rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return mark_submitted();\">\n",
loc("Preview")); loc("Preview"));
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return mark_submitted();\">\n", rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return mark_submitted();\">\n",
loc("Back")); loc("Back"));
@ -11948,6 +11954,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("<tr><td class=\"menuframe\"><span class=\"menu1\">\n"); rsprintf("<tr><td class=\"menuframe\"><span class=\"menu1\">\n");
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return chkform();\">\n", rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return chkform();\">\n",
loc("Submit")); loc("Submit"));
if (!getcfg(lbs->name, "Save drafts", str, sizeof(str)) || atoi(str) == 1)
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return save_draft();\">\n", rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return save_draft();\">\n",
loc("Save")); loc("Save"));