Conditional attributes get evaluated correctly during editing of existing entries

SVN revision: 830
This commit is contained in:
Stefan Ritt 2004-03-15 20:07:34 +00:00
parent da68e5d6da
commit e7efad7b9f

View File

@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG Contents: Web server program for Electronic Logbook ELOG
$Log$ $Log$
Revision 1.296 2004/03/15 20:07:34 midas
Conditional attributes get evaluated correctly during editing of existing entries
Revision 1.295 2004/03/15 08:02:46 midas Revision 1.295 2004/03/15 08:02:46 midas
Fixed crashing elogd in threaded display Fixed crashing elogd in threaded display
@ -6413,9 +6416,16 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
/* evaluate conditional attributes */ /* evaluate conditional attributes */
condition[0] = 0; condition[0] = 0;
for (i = 0; i < lbs->n_attr; i++) { for (index = 0; index < lbs->n_attr; index++) {
if (strchr(attrib[i], '{') && strchr(attrib[i], '}')) { for (i = 0; i < MAX_N_LIST && attr_options[index][i][0]; i++) {
strlcpy(str, strchr(attrib[i], '{') + 1, sizeof(str));
if (strchr(attr_options[index][i], '{') && strchr(attr_options[index][i], '}')) {
strlcpy(str, attr_options[index][i], sizeof(str));
*strchr(str, '{') = 0;
if (strieq(str, attrib[index])) {
strlcpy(str, strchr(attr_options[index][i], '{') + 1, sizeof(str));
if (*strchr(str, '}')) if (*strchr(str, '}'))
*strchr(str, '}') = 0; *strchr(str, '}') = 0;
@ -6427,6 +6437,8 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
} }
} }
} }
}
}
set_condition(condition); set_condition(condition);
@ -6950,11 +6962,9 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
if (strieq(attr_options[index][i], attrib[index]) if (strieq(attr_options[index][i], attrib[index])
|| strieq(str, attrib[index])) || strieq(str, attrib[index]))
rsprintf("<option selected value=\"%s\">%s\n", rsprintf("<option selected value=\"%s\">%s\n", str, str);
attr_options[index][i], str);
else else
rsprintf("<option value=\"%s\">%s\n", attr_options[index][i], rsprintf("<option value=\"%s\">%s\n", str, str);
str);
} }
rsprintf("</select>\n"); rsprintf("</select>\n");