Fixed various bugs with fixed attributes

SVN revision: 22
This commit is contained in:
Stefan Ritt 2002-01-29 10:06:23 +00:00
parent b72f9f1901
commit 60fa4fab10

105
elogd.c
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.8 2002/01/29 10:06:23 midas
Fixed various bugs with fixed attributes
Revision 1.7 2002/01/23 08:41:42 midas Revision 1.7 2002/01/23 08:41:42 midas
Added "Search all logbooks" flag Added "Search all logbooks" flag
@ -3387,67 +3390,81 @@ time_t now;
} }
} }
if (attr_options[index][0][0] == 0) /* display text box */
{ rsprintf("<tr><td nowrap bgcolor=%s><b>%s%s:</b></td>", gt("Categories bgcolor1"), attr_list[index], star);
/* display text box */
rsprintf("<tr><td nowrap bgcolor=%s><b>%s%s:</b></td>", gt("Categories bgcolor1"), attr_list[index], star);
if (attr_flags[index] & AF_LOCKED) /* if attribute cannot be changed, just display text */
if ((attr_flags[index] & AF_LOCKED) || (bedit && (attr_flags[index] & AF_FIXED)))
{
rsprintf("<td bgcolor=%s>%s\n", gt("Categories bgcolor2"), attrib[index]);
if (attr_flags[index] & AF_MULTI)
{ {
rsprintf("<td bgcolor=%s>%s\n", gt("Categories bgcolor2"), attrib[index]); for (i=0 ; i<MAX_N_LIST && attr_options[index][i][0] ; i++)
rsprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\"></td></tr>\n", {
attr_list[index], attrib[index]); sprintf(str, "%s%d", attr_list[index], i);
if (strstr(attrib[index], attr_options[index][i]))
rsprintf("<input type=hidden name=\"%s\" value=\"%s\">\n", str, attr_options[index][i]);
}
} }
else else
rsprintf("<td bgcolor=%s><input type=\"text\" size=80 maxlength=%d name=\"%s\" value=\"%s\"></td></tr>\n", rsprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\"></td></tr>\n",
gt("Categories bgcolor2"), NAME_LENGTH, attr_list[index], attrib[index]); attr_list[index], attrib[index]);
} }
else else
{ {
if (equal_ustring(attr_options[index][0], "boolean")) if (attr_options[index][0][0] == 0)
{ {
/* display checkbox */ rsprintf("<td bgcolor=%s><input type=\"text\" size=80 maxlength=%d name=\"%s\" value=\"%s\"></td></tr>\n",
rsprintf("<tr><td nowrap bgcolor=%s><b>%s%s:</b></td><td bgcolor=%s><input type=checkbox name=\"%s\" value=1>\n", gt("Categories bgcolor2"), NAME_LENGTH, attr_list[index], attrib[index]);
gt("Categories bgcolor1"), attr_list[index], star, gt("Categories bgcolor2"), attr_list[index]);
} }
else else
{ {
if (attr_flags[index] & AF_MULTI) if (equal_ustring(attr_options[index][0], "boolean"))
{ {
/* display multiple check boxes */ /* display checkbox */
rsprintf("<tr><td nowrap bgcolor=%s><b>%s%s:</b></td><td bgcolor=%s>\n", rsprintf("<td bgcolor=%s><input type=checkbox name=\"%s\" value=1>\n",
gt("Categories bgcolor1"), attr_list[index], star, gt("Categories bgcolor2")); gt("Categories bgcolor2"), attr_list[index]);
for (i=0 ; i<MAX_N_LIST && attr_options[index][i][0] ; i++)
{
sprintf(str, "%s%d", attr_list[index], i);
if (strstr(attrib[index], attr_options[index][i]))
rsprintf("<input type=checkbox checked name=\"%s\" value=\"%s\">%s&nbsp;\n", str, attr_options[index][i], attr_options[index][i]);
else
rsprintf("<input type=checkbox name=\"%s\" value=\"%s\">%s&nbsp;\n", str, attr_options[index][i], attr_options[index][i]);
}
rsprintf("</td></tr>\n");
} }
else else
{ {
/* display drop-down box */ if (attr_flags[index] & AF_MULTI)
rsprintf("<tr><td nowrap bgcolor=%s><b>%s%s:</b></td><td bgcolor=%s><select name=\"%s\">\n",
gt("Categories bgcolor1"), attr_list[index], star, gt("Categories bgcolor2"), attr_list[index]);
/* display emtpy option */
rsprintf("<option value=\"\">- %s -\n", loc("please select"));
for (i=0 ; i<MAX_N_LIST && attr_options[index][i][0] ; i++)
{ {
if (equal_ustring(attr_options[index][i], attrib[index])) /* display multiple check boxes */
rsprintf("<option selected value=\"%s\">%s\n", attr_options[index][i], attr_options[index][i]); rsprintf("<td bgcolor=%s>\n", gt("Categories bgcolor2"));
else
rsprintf("<option value=\"%s\">%s\n", attr_options[index][i], attr_options[index][i]);
}
rsprintf("</select></td></tr>\n"); for (i=0 ; i<MAX_N_LIST && attr_options[index][i][0] ; i++)
{
sprintf(str, "%s%d", attr_list[index], i);
if (strstr(attrib[index], attr_options[index][i]))
rsprintf("<input type=checkbox checked name=\"%s\" value=\"%s\">%s&nbsp;\n", str, attr_options[index][i], attr_options[index][i]);
else
rsprintf("<input type=checkbox name=\"%s\" value=\"%s\">%s&nbsp;\n", str, attr_options[index][i], attr_options[index][i]);
}
rsprintf("</td></tr>\n");
}
else
{
/* display drop-down box */
rsprintf("<td bgcolor=%s><select name=\"%s\">\n",
gt("Categories bgcolor2"), attr_list[index]);
/* display emtpy option */
rsprintf("<option value=\"\">- %s -\n", loc("please select"));
for (i=0 ; i<MAX_N_LIST && attr_options[index][i][0] ; i++)
{
if (equal_ustring(attr_options[index][i], attrib[index]))
rsprintf("<option selected value=\"%s\">%s\n", attr_options[index][i], attr_options[index][i]);
else
rsprintf("<option value=\"%s\">%s\n", attr_options[index][i], attr_options[index][i]);
}
rsprintf("</select></td></tr>\n");
}
} }
} }
} }