Attributes can now contain quotation marks

SVN revision: 752
This commit is contained in:
Stefan Ritt 2004-02-13 20:32:34 +00:00
parent ac4020a18f
commit 8bee43926f

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.242 2004/02/13 20:32:34 midas
Attributes can now contain quotation marks
Revision 1.241 2004/02/09 21:46:24 midas Revision 1.241 2004/02/09 21:46:24 midas
Implemented 'type <attribute> = date' Implemented 'type <attribute> = date'
@ -5565,28 +5568,28 @@ void strencode2(char *b, char *text)
{ {
int i; int i;
for (i = 0; i < (int) strlen(text); b++, i++) { *b = 0;
for (i = 0; i < (int) strlen(text); i++) {
switch (text[i]) { switch (text[i]) {
case '\n': case '\n':
sprintf(b, "<br>\n"); strcat(b, "<br>\n");
break; break;
case '<': case '<':
sprintf(b, "&lt;"); strcat(b, "&lt;");
break; break;
case '>': case '>':
sprintf(b, "&gt;"); strcat(b, "&gt;");
break; break;
case '&': case '&':
sprintf(b, "&amp;"); strcat(b, "&amp;");
break; break;
case '\"': case '\"':
sprintf(b, "&quot;"); strcat(b, "&quot;");
break; break;
default: default:
sprintf(b, "%c", text[i]); sprintf(b+strlen(b), "%c", text[i]);
} }
} }
*b = 0;
} }
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
@ -6397,7 +6400,6 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
day = pts->tm_mday; day = pts->tm_mday;
} }
/* display date selector */ /* display date selector */
rsprintf("<td class=\"attribvalue\"><select name=\"m%d\">\n", index); rsprintf("<td class=\"attribvalue\"><select name=\"m%d\">\n", index);
@ -6445,12 +6447,17 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("</script>\n"); rsprintf("</script>\n");
rsprintf("</td></tr>\n"); rsprintf("</td></tr>\n");
} else } else {
/* show normal edit field */ /* show normal edit field */
rsprintf rsprintf("<td class=\"attribvalue\">");
("<td class=\"attribvalue\"><input type=\"text\" size=%d maxlength=%d name=\"%s\" value=\"%s\"></td></tr>\n",
input_size, input_maxlen, ua, attrib[index]); strencode2(str, attrib[index]);
rsprintf("<input type=\"text\" size=%d maxlength=%d name=\"%s\" value=\"%s\">\n",
input_size, input_maxlen, ua, str);
rsprintf("</td></tr>\n");
}
} else { } else {
if (strieq(attr_options[index][0], "boolean")) { if (strieq(attr_options[index][0], "boolean")) {