Fixed wrong focus switching to text box for conditional attributes

SVN revision: 1691
This commit is contained in:
Stefan Ritt 2006-06-13 06:38:14 +00:00
parent be3a3558ff
commit f0dc911c2b

View File

@ -7694,7 +7694,7 @@ void xmlencode(char *text)
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void strencode2(char *b, char *text) void strencode2(char *b, char *text, int size)
{ {
int i; int i;
@ -7702,21 +7702,33 @@ void strencode2(char *b, char *text)
for (i = 0; i < (int) strlen(text); i++) { for (i = 0; i < (int) strlen(text); i++) {
switch (text[i]) { switch (text[i]) {
case '\n': case '\n':
if (strlen(b)+5 >= (unsigned int)size)
return;
strcat(b, "<br>\n"); strcat(b, "<br>\n");
break; break;
case '<': case '<':
if (strlen(b)+4 >= (unsigned int)size)
return;
strcat(b, "&lt;"); strcat(b, "&lt;");
break; break;
case '>': case '>':
if (strlen(b)+4 >= (unsigned int)size)
return;
strcat(b, "&gt;"); strcat(b, "&gt;");
break; break;
case '&': case '&':
if (strlen(b)+5 >= (unsigned int)size)
return;
strcat(b, "&amp;"); strcat(b, "&amp;");
break; break;
case '\"': case '\"':
if (strlen(b)+6 >= (unsigned int)size)
return;
strcat(b, "&quot;"); strcat(b, "&quot;");
break; break;
default: default:
if (strlen(b)+1 >= (unsigned int)size)
return;
sprintf(b + strlen(b), "%c", text[i]); sprintf(b + strlen(b), "%c", text[i]);
} }
} }
@ -8960,7 +8972,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("</head>\n"); rsprintf("</head>\n");
script[0] = 0; script[0] = 0;
if (isparam("inlineatt")) if (isparam("inlineatt") && *getparam("inlineatt"))
strcpy(script, " OnLoad=\"document.form1.Text.focus();\""); strcpy(script, " OnLoad=\"document.form1.Text.focus();\"");
if (getcfg(lbs->name, "Use Lock", str, sizeof(str)) && atoi(str) == 1) if (getcfg(lbs->name, "Use Lock", str, sizeof(str)) && atoi(str) == 1)
@ -9175,7 +9187,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\">\n", str, attr_options[index][i]); rsprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\">\n", str, attr_options[index][i]);
} }
} else { } else {
strencode2(str, attrib[index]); strencode2(str, attrib[index], sizeof(str));
rsprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\"></td>\n", ua, str); rsprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\"></td>\n", ua, str);
} }
} else { } else {
@ -9251,7 +9263,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
/* show normal edit field */ /* show normal edit field */
rsprintf("<td%s class=\"attribvalue\">", title); rsprintf("<td%s class=\"attribvalue\">", title);
strencode2(str, attrib[index]); strencode2(str, attrib[index], sizeof(str));
rsprintf rsprintf
("<input type=\"text\" size=%d maxlength=%d name=\"%s\" value=\"%s\" onChange=\"mod();\">\n", ("<input type=\"text\" size=%d maxlength=%d name=\"%s\" value=\"%s\" onChange=\"mod();\">\n",
input_size, input_maxlen, ua, str); input_size, input_maxlen, ua, str);
@ -15691,7 +15703,7 @@ void build_ref(char *ref, int size, char *mode, char *expand, char *attach, char
/* replace any '&' by '&amp;' */ /* replace any '&' by '&amp;' */
strlcpy(str, ref, sizeof(str)); strlcpy(str, ref, sizeof(str));
strencode2(ref, str); strencode2(ref, str, sizeof(ref));
} }
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
@ -18703,11 +18715,23 @@ int compose_email(LOGBOOK * lbs, char *rcpt_to, char *mail_to, int message_id,
else else
strcat(mail_param, "&"); strcat(mail_param, "&");
/* convert '"',CR,LF,TAB to ' ' */
while (strchr(mail_to, '"'))
*strchr(mail_to, '"') = ' ';
while (strchr(mail_to, '\r'))
*strchr(mail_to, '\r') = ' ';
while (strchr(mail_to, '\n'))
*strchr(mail_to, '\n') = ' ';
while (strchr(mail_to, '\t'))
*strchr(mail_to, '\t') = ' ';
n = strbreak(mail_to, list, MAX_PARAM, ","); n = strbreak(mail_to, list, MAX_PARAM, ",");
if (n < 10) { if (n < 10) {
for (i = 0; i < n && i < MAX_PARAM; i++) { for (i = 0; i < n && i < MAX_PARAM; i++) {
sprintf(mail_param + strlen(mail_param), "mail%d=%s", i, list[i]); strencode2(str, list[i], sizeof(str));
url_encode(str, sizeof(str));
sprintf(mail_param + strlen(mail_param), "mail%d=%s", i, str);
if (i < n - 1) if (i < n - 1)
strcat(mail_param, "&"); strcat(mail_param, "&");
} }
@ -20212,7 +20236,7 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
rsprintf("<tr><td class=\"attribhead\">\n"); rsprintf("<tr><td class=\"attribhead\">\n");
for (i = 0; i < lbs->n_attr; i++) { for (i = 0; i < lbs->n_attr; i++) {
strencode2(str, attrib[i]); strencode2(str, attrib[i], sizeof(str));
rsprintf("<input type=hidden name=\"%s\" value=\"%s\">\n", attr_list[i], str); rsprintf("<input type=hidden name=\"%s\" value=\"%s\">\n", attr_list[i], str);
} }