mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-12 19:33:03 +00:00
Implemented conditional attributes in find form
SVN revision: 2104
This commit is contained in:
parent
a8c72d61e7
commit
1382423a36
33
src/elogd.c
33
src/elogd.c
@ -11191,7 +11191,7 @@ void show_find_form(LOGBOOK * lbs)
|
|||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char str[NAME_LENGTH], mode[NAME_LENGTH], comment[NAME_LENGTH], option[NAME_LENGTH], login_name[256],
|
char str[NAME_LENGTH], mode[NAME_LENGTH], comment[NAME_LENGTH], option[NAME_LENGTH], login_name[256],
|
||||||
full_name[256], user_email[256];
|
full_name[256], user_email[256], enc_attr[NAME_LENGTH], attrib[MAX_N_ATTR][NAME_LENGTH];
|
||||||
|
|
||||||
/*---- header ----*/
|
/*---- header ----*/
|
||||||
|
|
||||||
@ -11208,8 +11208,19 @@ void show_find_form(LOGBOOK * lbs)
|
|||||||
rsprintf("<input type=submit value=\"%s\">\n", loc("Search"));
|
rsprintf("<input type=submit value=\"%s\">\n", loc("Search"));
|
||||||
rsprintf("<input type=reset value=\"%s\">\n", loc("Reset Form"));
|
rsprintf("<input type=reset value=\"%s\">\n", loc("Reset Form"));
|
||||||
rsprintf("<input type=submit name=cmd value=\"%s\">\n", loc("Back"));
|
rsprintf("<input type=submit name=cmd value=\"%s\">\n", loc("Back"));
|
||||||
|
rsprintf("<input type=hidden name=jcmd value=\"\">\n");
|
||||||
rsprintf("</span></td></tr>\n\n");
|
rsprintf("</span></td></tr>\n\n");
|
||||||
|
|
||||||
|
/*---- evaluate conditional attributes ----*/
|
||||||
|
|
||||||
|
for (i = 0; i < lbs->n_attr; i++)
|
||||||
|
attrib[i][0] = 0;
|
||||||
|
|
||||||
|
/* get attributes from parameters */
|
||||||
|
attrib_from_param(lbs->n_attr, attrib);
|
||||||
|
|
||||||
|
evaluate_conditions(lbs, attrib);
|
||||||
|
|
||||||
/*---- entry form ----*/
|
/*---- entry form ----*/
|
||||||
|
|
||||||
rsprintf("<tr><td class=\"form1\">\n");
|
rsprintf("<tr><td class=\"form1\">\n");
|
||||||
@ -11468,15 +11479,23 @@ void show_find_form(LOGBOOK * lbs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
rsprintf("<select name=\"%s\">\n", attr_list[i]);
|
rsprintf("<select name=\"%s\"", attr_list[i]);
|
||||||
|
|
||||||
|
if (is_cond_attr(i))
|
||||||
|
rsprintf(" onChange=\"document.form1.jcmd.value='Find';document.form1.submit();\"");
|
||||||
|
rsprintf(">\n");
|
||||||
|
|
||||||
rsprintf("<option value=\"\">\n");
|
rsprintf("<option value=\"\">\n");
|
||||||
for (j = 0; j < MAX_N_LIST && attr_options[i][j][0]; j++) {
|
for (j = 0; j < MAX_N_LIST && attr_options[i][j][0]; j++) {
|
||||||
|
strencode2(str, attr_options[i][j], sizeof(str));
|
||||||
|
if (strchr(str, '{'))
|
||||||
|
*strchr(str, '{') = 0;
|
||||||
|
strencode2(enc_attr, attrib[i], sizeof(enc_attr));
|
||||||
|
|
||||||
strcpy(option, attr_options[i][j]);
|
if (strieq(attr_options[i][j], attrib[i]) || strieq(str, enc_attr))
|
||||||
if (strchr(option, '{'))
|
rsprintf("<option selected value=\"%s\">%s\n", str, str);
|
||||||
*strchr(option, '{') = 0;
|
else
|
||||||
|
rsprintf("<option value=\"%s\">%s\n", str, str);
|
||||||
rsprintf("<option value=\"%s\">%s\n", option, option);
|
|
||||||
}
|
}
|
||||||
rsprintf("</select>\n");
|
rsprintf("</select>\n");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user