mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-10 18:23:28 +00:00
Modifications made on flight CA931
SVN revision: 1494
This commit is contained in:
parent
ddda42bfa8
commit
b00d86e730
@ -861,11 +861,12 @@ attribute which has an options list, the preset value is selected in the drop
|
|||||||
down box by default.<br><br>
|
down box by default.<br><br>
|
||||||
|
|
||||||
A special option are automatically generated tags, which are automatically incremented
|
A special option are automatically generated tags, which are automatically incremented
|
||||||
for each new message. This is achieved by putting a "%" into the preset string, which
|
for each new message. This is achieved by putting #'s into the preset string, which
|
||||||
is used as a <i>printf</i> format specifier. A statement like
|
is used as a placeholder for the incrementing index. Each "#" stands for one digit,
|
||||||
|
thus the statement
|
||||||
<p>
|
<p>
|
||||||
<pre>
|
<pre>
|
||||||
Preset Number = XYZ-%05d
|
Preset Number = XYZ-#####
|
||||||
</pre>
|
</pre>
|
||||||
results in automatically created attributes <i>"Number"</i> of the form<p>
|
results in automatically created attributes <i>"Number"</i> of the form<p>
|
||||||
<pre>
|
<pre>
|
||||||
@ -873,9 +874,32 @@ XYZ-00001
|
|||||||
XYZ-00002
|
XYZ-00002
|
||||||
XYZ-00003
|
XYZ-00003
|
||||||
</pre>
|
</pre>
|
||||||
and so on.
|
and so on. In addition to the #'s one may specify format specifiers which are passed
|
||||||
|
to the <a href="http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_427.html#IDX2636">
|
||||||
|
strftime</a> function. This allows to create tags wich contain the current year, month
|
||||||
|
and so on. Once the date part of the attribute changes, the index restarts from one.
|
||||||
|
The statement
|
||||||
<p>
|
<p>
|
||||||
|
<pre>
|
||||||
|
Preset Number = XYZ-%Y-%b-###
|
||||||
|
</pre>
|
||||||
|
results in automatically created attributes <i>"Number"</i> of the form<p>
|
||||||
|
<pre>
|
||||||
|
XYZ-2005-Oct-001
|
||||||
|
XYZ-2005-Oct-002
|
||||||
|
XYZ-2005-Oct-003
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
and
|
||||||
|
<p>
|
||||||
|
<pre>
|
||||||
|
XYZ-2005-Nov-001
|
||||||
|
XYZ-2005-Nov-002
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
on the next month.
|
||||||
|
<p>
|
||||||
|
|
||||||
<LI><b><code>Preset text = <string> or <file></code></b>
|
<LI><b><code>Preset text = <string> or <file></code></b>
|
||||||
<br>
|
<br>
|
||||||
This preset value is used for the main body text. It can be a string or a file,
|
This preset value is used for the main body text. It can be a string or a file,
|
||||||
|
|||||||
119
src/elogd.c
119
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.756 2005/10/04 17:55:44 ritt
|
||||||
|
Modifications made on flight CA931
|
||||||
|
|
||||||
Revision 1.755 2005/09/21 06:47:32 ritt
|
Revision 1.755 2005/09/21 06:47:32 ritt
|
||||||
Added '\' escape for smileys
|
Added '\' escape for smileys
|
||||||
|
|
||||||
@ -8732,29 +8735,56 @@ void show_change_pwd_page(LOGBOOK * lbs)
|
|||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
|
|
||||||
int get_last_index(LOGBOOK * lbs, int index)
|
void get_auto_index(LOGBOOK * lbs, int index, char *format, char *retstr, int size)
|
||||||
/* return value of specific attribute of last entry, can be used to
|
/* return value of specific attribute of last entry, can be used to
|
||||||
auto-increment tags */
|
auto-increment tags */
|
||||||
{
|
{
|
||||||
int i, message_id;
|
int i, message_id, loc, len, old_index;
|
||||||
char str[80], attrib[MAX_N_ATTR][NAME_LENGTH], att[MAX_ATTACHMENTS][256];
|
char str[NAME_LENGTH], attrib[MAX_N_ATTR][NAME_LENGTH], att[MAX_ATTACHMENTS][256];
|
||||||
|
time_t now;
|
||||||
|
|
||||||
|
if (strchr(format, '%') == NULL && strchr(format, '#') == NULL) {
|
||||||
|
strlcpy(retstr, format, size);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
time(&now);
|
||||||
|
my_strftime(retstr, size, format, localtime(&now));
|
||||||
|
|
||||||
|
if (strchr(retstr, '#') == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* record location and length of ###'s */
|
||||||
|
for (i=loc=0,len=1 ; i<(int)strlen(retstr) ; i++) {
|
||||||
|
if (retstr[i] == '#') {
|
||||||
|
if (loc == 0)
|
||||||
|
loc = i;
|
||||||
|
if (i>0 && retstr[i-1] == '#')
|
||||||
|
len++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get attribute from last entry */
|
||||||
str[0] = 0;
|
str[0] = 0;
|
||||||
message_id = el_search_message(lbs, EL_LAST, 0, FALSE);
|
message_id = el_search_message(lbs, EL_LAST, 0, FALSE);
|
||||||
|
|
||||||
if (!message_id)
|
if (!message_id) {
|
||||||
return 0;
|
/* start with 1 */
|
||||||
|
sprintf(retstr+loc, "%0*d", len, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
el_retrieve(lbs, message_id, NULL, attr_list, attrib, lbs->n_attr, NULL, 0, NULL, NULL, att, NULL, NULL);
|
el_retrieve(lbs, message_id, NULL, attr_list, attrib, lbs->n_attr, NULL, 0, NULL, NULL, att, NULL, NULL);
|
||||||
|
|
||||||
strcpy(str, attrib[index]);
|
/* if date part changed, start over with inded */
|
||||||
|
if (strncmp(attrib[index], retstr, loc) != 0)
|
||||||
|
old_index = 0;
|
||||||
|
else
|
||||||
|
/* retrieve old index */
|
||||||
|
old_index = atoi(attrib[index]+loc);
|
||||||
|
|
||||||
/* look for first digit, return value */
|
/* increment index */
|
||||||
for (i = 0; i < (int) strlen(str); i++)
|
sprintf(retstr+loc, "%0*d", len, old_index+1);
|
||||||
if (isdigit(str[i]))
|
|
||||||
break;
|
|
||||||
|
|
||||||
return atoi(str + i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
@ -9197,10 +9227,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
/* check for index substitution */
|
/* check for index substitution */
|
||||||
if (!bedit && strchr(preset, '%')) {
|
if (!bedit && strchr(preset, '%')) {
|
||||||
/* get index */
|
/* get index */
|
||||||
i = get_last_index(lbs, index);
|
get_auto_index(lbs, index, preset, str, sizeof(str));
|
||||||
|
strcpy(preset, str);
|
||||||
strcpy(str, preset);
|
|
||||||
sprintf(preset, str, i + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strchr(preset, '%'))
|
if (!strchr(preset, '%'))
|
||||||
@ -9221,10 +9249,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
/* check for index substitution */
|
/* check for index substitution */
|
||||||
if (!bedit && strchr(preset, '%')) {
|
if (!bedit && strchr(preset, '%')) {
|
||||||
/* get index */
|
/* get index */
|
||||||
i = get_last_index(lbs, index);
|
get_auto_index(lbs, index, preset, str, sizeof(str));
|
||||||
|
strcpy(preset, str);
|
||||||
strcpy(str, preset);
|
|
||||||
sprintf(preset, str, i + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strchr(preset, '%'))
|
if (!strchr(preset, '%'))
|
||||||
@ -9267,10 +9293,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
/* check for index substitution */
|
/* check for index substitution */
|
||||||
if (!bedit && strchr(preset, '%')) {
|
if (!bedit && strchr(preset, '%')) {
|
||||||
/* get index */
|
/* get index */
|
||||||
i = get_last_index(lbs, index);
|
get_auto_index(lbs, index, preset, str, sizeof(str));
|
||||||
|
strcpy(preset, str);
|
||||||
strcpy(str, preset);
|
|
||||||
sprintf(preset, str, i + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strchr(preset, '%'))
|
if (!strchr(preset, '%'))
|
||||||
@ -9291,10 +9315,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
/* check for index substitution */
|
/* check for index substitution */
|
||||||
if (!bedit && strchr(preset, '%')) {
|
if (!bedit && strchr(preset, '%')) {
|
||||||
/* get index */
|
/* get index */
|
||||||
i = get_last_index(lbs, index);
|
get_auto_index(lbs, index, preset, str, sizeof(str));
|
||||||
|
strcpy(preset, str);
|
||||||
strcpy(str, preset);
|
|
||||||
sprintf(preset, str, i + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strchr(preset, '%'))
|
if (!strchr(preset, '%'))
|
||||||
@ -10562,14 +10584,16 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
&& atoi(str) == 1)) {
|
&& atoi(str) == 1)) {
|
||||||
if (getcfg(lbs->name, "Suppress default", str, sizeof(str))) {
|
if (getcfg(lbs->name, "Suppress default", str, sizeof(str))) {
|
||||||
if (atoi(str) == 0) {
|
if (atoi(str) == 0) {
|
||||||
rsprintf("<input type=checkbox name=suppress value=1>%s\n", loc("Suppress Email notification"));
|
rsprintf("<input type=\"checkbox\" name=\"suppress\" id=\"suppress\" value=\"1\">");
|
||||||
|
rsprintf("<label for=\"suppress\">%s</label>\n", loc("Suppress Email notification"));
|
||||||
} else if (atoi(str) == 1) {
|
} else if (atoi(str) == 1) {
|
||||||
rsprintf("<input type=checkbox checked name=suppress value=1>%s\n",
|
rsprintf("<input type=\"checkbox\" checked name=\"suppress\" id=\"suppress\" value=\"1\">");
|
||||||
loc("Suppress Email notification"));
|
rsprintf("<label for=\"suppress\">%s</label>\n", loc("Suppress Email notification"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
rsprintf("<input type=checkbox name=suppress value=1>%s\n", loc("Suppress Email notification"));
|
rsprintf("<input type=\"checkbox\" name=\"suppress\" id=\"suppress\" value=\"1\">");
|
||||||
|
rsprintf("<label for=\"suppress\">%s</label>\n", loc("Suppress Email notification"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10578,16 +10602,17 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
if (getcfg(lbs->name, "Suppress execute default", str, sizeof(str))) {
|
if (getcfg(lbs->name, "Suppress execute default", str, sizeof(str))) {
|
||||||
if (atoi(str) == 0) {
|
if (atoi(str) == 0) {
|
||||||
rsprintf(" \n");
|
rsprintf(" \n");
|
||||||
rsprintf("<input type=checkbox name=shell_suppress value=1>%s\n",
|
rsprintf("<input type=\"checkbox\" name=\"shell_suppress\" id=\"shell_suppress\" value=1>");
|
||||||
loc("Suppress shell execution"));
|
rsprintf("<label for=\"shell_suppress\">%s</label>\n", loc("Suppress shell execution"));
|
||||||
} else if (atoi(str) == 1) {
|
} else if (atoi(str) == 1) {
|
||||||
rsprintf(" \n");
|
rsprintf(" \n");
|
||||||
rsprintf("<input type=checkbox checked name=shell_suppress value=1>%s\n",
|
rsprintf("<input type=\"checkbox\" checked name=\"shell_suppress\" id=\"shell_suppress\" value=1>");
|
||||||
loc("Suppress shell execution"));
|
rsprintf("<label for=\"shell_suppress\">%s</label>\n", loc("Suppress shell execution"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rsprintf(" \n");
|
rsprintf(" \n");
|
||||||
rsprintf("<input type=checkbox name=shell_suppress value=1>%s\n", loc("Suppress shell execution"));
|
rsprintf("<input type=\"checkbox\" name=\"shell_suppress\" id=\"shell_suppress\" value=1>");
|
||||||
|
rsprintf("<label for=\"shell_suppress\">%s</label>\n", loc("Suppress shell execution"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10595,16 +10620,17 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
if (getcfg(lbs->name, "Suppress execute default", str, sizeof(str))) {
|
if (getcfg(lbs->name, "Suppress execute default", str, sizeof(str))) {
|
||||||
if (atoi(str) == 0) {
|
if (atoi(str) == 0) {
|
||||||
rsprintf(" \n");
|
rsprintf(" \n");
|
||||||
rsprintf("<input type=checkbox name=shell_suppress value=1>%s\n",
|
rsprintf("<input type=\"checkbox\" name=\"shell_suppress\" id=\"shell_suppress\" value=1>");
|
||||||
loc("Suppress shell execution"));
|
rsprintf("<label for=\"shell_suppress\">%s</label>\n", loc("Suppress shell execution"));
|
||||||
} else if (atoi(str) == 1) {
|
} else if (atoi(str) == 1) {
|
||||||
rsprintf(" \n");
|
rsprintf(" \n");
|
||||||
rsprintf("<input type=checkbox checked name=shell_suppress value=1>%s\n",
|
rsprintf("<input type=\"checkbox\" checked name=\"shell_suppress\" id=\"shell_suppress\" value=1>");
|
||||||
loc("Suppress shell execution"));
|
rsprintf("<label for=\"shell_suppress\">%s</label>\n", loc("Suppress shell execution"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rsprintf(" \n");
|
rsprintf(" \n");
|
||||||
rsprintf("<input type=checkbox name=shell_suppress value=1>%s\n", loc("Suppress shell execution"));
|
rsprintf("<input type=\"checkbox\" name=\"shell_suppress\" id=\"shell_suppress\" value=1>");
|
||||||
|
rsprintf("<label for=\"shell_suppress\">%s</label>\n", loc("Suppress shell execution"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10613,14 +10639,17 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
if (getcfg(lbs->name, "Resubmit default", str, sizeof(str))) {
|
if (getcfg(lbs->name, "Resubmit default", str, sizeof(str))) {
|
||||||
if (atoi(str) == 0) {
|
if (atoi(str) == 0) {
|
||||||
rsprintf(" \n");
|
rsprintf(" \n");
|
||||||
rsprintf("<input type=checkbox name=resubmit value=1>%s\n", loc("Resubmit as new entry"));
|
rsprintf("<input type=\"checkbox\" name=\"resubmit\" id=\"resubmit\" value=1>");
|
||||||
|
rsprintf("<label for=\"resubmit\">%s</lable>\n", loc("Resubmit as new entry"));
|
||||||
} else if (atoi(str) == 1) {
|
} else if (atoi(str) == 1) {
|
||||||
rsprintf(" \n");
|
rsprintf(" \n");
|
||||||
rsprintf("<input type=checkbox checked name=resubmit value=1>%s\n", loc("Resubmit as new entry"));
|
rsprintf("<input type=\"checkbox\" checked name=\"resubmit\" id=\"resubmit\" value=1>");
|
||||||
|
rsprintf("<label for=\"resubmit\">%s</lable>\n", loc("Resubmit as new entry"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rsprintf(" \n");
|
rsprintf(" \n");
|
||||||
rsprintf("<input type=checkbox name=resubmit value=1>%s\n", loc("Resubmit as new entry"));
|
rsprintf("<input type=\"checkbox\" name=\"resubmit\" id=\"resubmit\" value=1>");
|
||||||
|
rsprintf("<label for=\"resubmit\">%s</lable>\n", loc("Resubmit as new entry"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user