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

@ -2710,13 +2710,21 @@ Options Location = Main Building{a}, New Building{b}, Old Building{c}
selecting a certain time period. Following options are possible: <b>0, 1, 3, selecting a certain time period. Following options are possible: <b>0, 1, 3,
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>
<b><code>Save drafts = 0|1</code></b><br>
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 <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> <li>
<b><code>Autosave = &lt;seconds&gt;</code></b><br> <b><code>Autosave = &lt;seconds&gt;</code></b><br>
Starting with version 3.1, ELOG supports auto saving. When text for a new Drafts can be sent to the server regularly after some editing (see previous
entry is entered in the browser, it might get lost if the browser windows is option). This option determines the interval this is done. The default is
closed before the entry has been submitted. In order to avoid this, the text <b><code>10</code></b> seconds after the last edit. Setting Autosave to
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
zero disables the autosave functionality. zero disables the autosave functionality.
</li> </li>
</ul> </ul>

View File

@ -10204,6 +10204,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
autosave = atoi(str); autosave = atoi(str);
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");
@ -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"));
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return save_draft();\">\n",
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",
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,7 +11954,9 @@ 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"));
rsprintf("<input type=\"submit\" name=\"cmd\" value=\"%s\" onClick=\"return save_draft();\">\n",
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",
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)