Fixed bug in el_decode, added <label> to buttons

SVN revision: 795
This commit is contained in:
Stefan Ritt 2004-02-26 12:41:42 +00:00
parent 0e3e4199f0
commit 789530c569

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.266 2004/02/26 12:41:42 midas
Fixed bug in el_decode, added <label> to buttons
Revision 1.265 2004/02/25 15:55:19 midas Revision 1.265 2004/02/25 15:55:19 midas
Expand substitutions with 'preset' and conditional attributes Expand substitutions with 'preset' and conditional attributes
@ -2490,13 +2493,23 @@ void el_decode(char *message, char *key, char *result)
} while (1); } while (1);
if ((pc = strstr(message, key)) != NULL && pc < ph /* go through all lines */
&& (*(pc - 1) == '\n' || *(pc - 1) == '\r')) { for (pc = message ; pc < ph ; ) {
for (pc = strstr(message, key) + strlen(key); *pc != '\n' && *pc != '\r';)
*result++ = *pc++; if (strncmp(pc, key, strlen(key)) == 0) {
*result = 0; pc += strlen(key);
} else while (*pc != '\n' && *pc != '\r')
*result = 0; *result++ = *pc++;
*result = 0;
return;
}
pc = strchr(pc, '\n');
if (pc == NULL)
return;
while (*pc && (*pc == '\n' || *pc == '\r'))
pc++;
}
} }
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
@ -6618,13 +6631,14 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
sprintf(str, "%s_%d", ua, i); sprintf(str, "%s_%d", ua, i);
if (strstr(attrib[index], attr_options[index][i])) if (strstr(attrib[index], attr_options[index][i]))
rsprintf rsprintf("<nobr><input type=checkbox id=\"%s\" name=\"%s\" value=\"%s\" checked>\n",
("<nobr><input type=checkbox checked name=\"%s\" value=\"%s\">%s</nobr>\n", str, str, attr_options[index][i]);
str, attr_options[index][i], attr_options[index][i]);
else else
rsprintf rsprintf("<nobr><input type=checkbox id=\"%s\" name=\"%s\" value=\"%s\">\n",
("<nobr><input type=checkbox name=\"%s\" value=\"%s\">%s</nobr>\n", str, str, attr_options[index][i]);
str, attr_options[index][i], attr_options[index][i]);
rsprintf("<label for=\"%s\">%s</label></nobr>\n",
str, attr_options[index][i]);
if (format_flags & AFF_MULTI_LINE) if (format_flags & AFF_MULTI_LINE)
rsprintf("<br>"); rsprintf("<br>");
@ -6637,13 +6651,14 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
for (i = 0; i < MAX_N_LIST && attr_options[index][i][0]; i++) { for (i = 0; i < MAX_N_LIST && attr_options[index][i][0]; i++) {
if (strstr(attrib[index], attr_options[index][i])) if (strstr(attrib[index], attr_options[index][i]))
rsprintf rsprintf("<nobr><input type=radio id=\"%s\" name=\"%s\" value=\"%s\" checked>\n",
("<nobr><input type=radio checked name=\"%s\" value=\"%s\">%s</nobr>\n", attr_options[index][i], ua, attr_options[index][i]);
ua, attr_options[index][i], attr_options[index][i]);
else else
rsprintf rsprintf("<nobr><input type=radio id=\"%s\" name=\"%s\" value=\"%s\">\n",
("<nobr><input type=radio name=\"%s\" value=\"%s\">%s</nobr>\n", attr_options[index][i], ua, attr_options[index][i]);
ua, attr_options[index][i], attr_options[index][i]);
rsprintf("<label for=\"%s\">%s</label></nobr>\n",
attr_options[index][i], attr_options[index][i]);
if (format_flags & AFF_MULTI_LINE) if (format_flags & AFF_MULTI_LINE)
rsprintf("<br>"); rsprintf("<br>");
@ -7116,61 +7131,56 @@ void show_find_form(LOGBOOK * lbs)
if (!getcfg(lbs->name, "Show text", str) || atoi(str) == 1) { if (!getcfg(lbs->name, "Show text", str) || atoi(str) == 1) {
if (strieq(mode, "Full")) if (strieq(mode, "Full"))
rsprintf("<input type=radio name=mode value=\"full\" checked>%s&nbsp;&nbsp;\n", rsprintf("<input type=radio id=\"full\" name=\"mode\" value=\"full\" checked>");
loc("Display full entries"));
else else
rsprintf("<input type=radio name=mode value=\"full\">%s&nbsp;&nbsp;\n", rsprintf("<input type=radio id=\"full\" name=\"mode\" value=\"full\">");
loc("Display full entries")); rsprintf("<label for=\"full\">%s&nbsp;&nbsp;</label>\n", loc("Display full entries"));
if (strieq(mode, "Summary")) if (strieq(mode, "Summary"))
rsprintf rsprintf("<input type=radio id=\"summary\" name=\"mode\" value=\"summary\" checked>");
("<input type=radio name=mode value=\"summary\" checked>%s&nbsp;&nbsp;\n",
loc("Summary only"));
else else
rsprintf("<input type=radio name=mode value=\"summary\">%s&nbsp;&nbsp;\n", rsprintf("<input type=radio id=\"summary\" name=\"mode\" value=\"summary\">");
loc("Summary only")); rsprintf("<label for=\"summary\">%s&nbsp;&nbsp;</label>\n", loc("Summary only"));
} else { } else {
if (strieq(mode, "Full") || strieq(mode, "Summary")) if (strieq(mode, "Full") || strieq(mode, "Summary"))
rsprintf rsprintf("<input type=radio id=\"summary\" name=\"mode\" value=\"summary\" checked>");
("<input type=radio name=mode value=\"summary\" checked>%s&nbsp;&nbsp;\n",
loc("Summary"));
else else
rsprintf("<input type=radio name=mode value=\"summary\">%s&nbsp;&nbsp;\n", rsprintf("<input type=radio id=\"summary\" name=\"mode\" value=\"summary\">");
loc("Summary")); rsprintf("<label for=\"summary\">%s&nbsp;&nbsp;</label>\n", loc("Summary"));
} }
if (strieq(mode, "Threaded")) if (strieq(mode, "Threaded"))
rsprintf("<input type=radio name=mode value=\"threaded\" checked>%s&nbsp;&nbsp;\n", rsprintf("<input type=radio id=\"threaded\" name=\"mode\" value=\"threaded\" checked>");
loc("Display threads"));
else else
rsprintf("<input type=radio name=mode value=\"threaded\">%s&nbsp;&nbsp;\n", rsprintf("<input type=radio id=\"threaded\" name=\"mode\" value=\"threaded\">");
loc("Display threads")); rsprintf("<label for=\"threaded\">%s&nbsp;&nbsp;</label>\n", loc("Display threads"));
if (strieq(mode, "CSV")) if (strieq(mode, "CSV"))
rsprintf("<input type=radio name=mode value=\"CSV\" checked>%s&nbsp;&nbsp;\n", rsprintf("<input type=radio id=\"CSV\" name=\"mode\" value=\"CSV\" checked>");
loc("Display comma-separated values (CSV)"));
else else
rsprintf("<input type=radio name=mode value=\"CSV\">%s&nbsp;&nbsp;\n", rsprintf("<input type=radio id=\"CSV\" name=\"mode\" value=\"CSV\">");
loc("Display comma-separated values (CSV)"));
rsprintf("<label for=\"CSV\">%s&nbsp;&nbsp;</label>\n", loc("Display comma-separated values (CSV)"));
rsprintf("</td></tr>\n"); rsprintf("</td></tr>\n");
rsprintf("<tr><td class=\"form2\"><b>%s:</b><br>", loc("Options")); rsprintf("<tr><td class=\"form2\"><b>%s:</b><br>", loc("Options"));
if (!getcfg(lbs->name, "Number attachments", str) || atoi(str) > 0) if (!getcfg(lbs->name, "Number attachments", str) || atoi(str) > 0) {
rsprintf("<input type=checkbox name=attach value=1>%s<br>\n", rsprintf("<input type=checkbox id=\"attach\" name=\"attach\" value=1>");
loc("Show attachments")); rsprintf("<label for=\"attach\">%s<br></label>\n", loc("Show attachments"));
}
rsprintf("<input type=checkbox name=printable value=1>%s<br>\n", rsprintf("<input type=checkbox id=\"printable\" name=\"printable\" value=1>");
loc("Printable output")); rsprintf("<label for=\"printable\">%s<br></label>\n", loc("Printable output"));
if (getcfg(lbs->name, "Reverse sort", str) && atoi(str) == 1) if (getcfg(lbs->name, "Reverse sort", str) && atoi(str) == 1)
rsprintf("<input type=checkbox checked name=reverse value=1>%s<br>\n", rsprintf("<input type=checkbox id=\"reverse\" name=\"reverse\" value=1 checked>");
loc("Sort in reverse order"));
else else
rsprintf("<input type=checkbox name=reverse value=1>%s<br>\n", rsprintf("<input type=checkbox id=\"reverse\" name=\"reverse\" value=1>");
loc("Sort in reverse order")); rsprintf("<label for=\"reverse\">%s<br></label>\n", loc("Sort in reverse order"));
/* count logbooks */ /* count logbooks */
for (i = 0;; i++) { for (i = 0;; i++) {
@ -7298,11 +7308,11 @@ void show_find_form(LOGBOOK * lbs)
("<td class=\"attribvalue\"><input type=\"text\" size=\"30\" maxlength=\"80\" name=\"subtext\">\n"); ("<td class=\"attribvalue\"><input type=\"text\" size=\"30\" maxlength=\"80\" name=\"subtext\">\n");
rsprintf("<i>%s</i></td></tr>\n", loc("(case insensitive substring)")); rsprintf("<i>%s</i></td></tr>\n", loc("(case insensitive substring)"));
rsprintf rsprintf("<tr><td><td class=\"attribvalue\">\n");
("<tr><td><td class=\"attribvalue\"><input type=checkbox name=sall value=1>%s</td></tr>\n", rsprintf("<input type=checkbox id=\"sall\" name=\"sall\" value=1>\n");
loc("Search text also in attributes")); rsprintf("<label for=\"sall\">%s</label>\n", loc("Search text also in attributes"));
rsprintf("</table></td></tr></table>\n"); rsprintf("</td></tr></table></td></tr></table>\n");
show_bottom_text(lbs); show_bottom_text(lbs);
rsprintf("</form></body></html>\r\n"); rsprintf("</form></body></html>\r\n");
} }