mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Implemented 'show attributes' and removed 'hidden attributes'
SVN revision: 1172
This commit is contained in:
parent
266e485e6b
commit
2c0b081059
44
src/elogd.c
44
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.537 2005/01/17 16:14:51 midas
|
||||||
|
Implemented 'show attributes' and removed 'hidden attributes'
|
||||||
|
|
||||||
Revision 1.536 2005/01/17 15:42:05 midas
|
Revision 1.536 2005/01/17 15:42:05 midas
|
||||||
Made extendable attributes work with MOptions
|
Made extendable attributes work with MOptions
|
||||||
|
|
||||||
@ -951,7 +954,6 @@ char author_list[MAX_N_LIST][NAME_LENGTH] = {
|
|||||||
#define AF_DATE (1<<8)
|
#define AF_DATE (1<<8)
|
||||||
#define AF_NUMERIC (1<<9)
|
#define AF_NUMERIC (1<<9)
|
||||||
#define AF_USERLIST (1<<10)
|
#define AF_USERLIST (1<<10)
|
||||||
#define AF_HIDDEN (1<<11)
|
|
||||||
|
|
||||||
/* attribute format flags */
|
/* attribute format flags */
|
||||||
#define AFF_SAME_LINE 1
|
#define AFF_SAME_LINE 1
|
||||||
@ -6087,15 +6089,6 @@ and attr_flags arrays */
|
|||||||
attr_flags[j] |= AF_EXTENDABLE;
|
attr_flags[j] |= AF_EXTENDABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for hidden attributes */
|
|
||||||
getcfg(logbook, "Hidden Attributes", list, sizeof(list));
|
|
||||||
m = strbreak(list, tmp_list, MAX_N_ATTR, ",");
|
|
||||||
for (i = 0; i < m; i++) {
|
|
||||||
for (j = 0; j < n; j++)
|
|
||||||
if (strieq(attr_list[j], tmp_list[i]))
|
|
||||||
attr_flags[j] |= AF_HIDDEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
sprintf(str, "Type %s", attr_list[i]);
|
sprintf(str, "Type %s", attr_list[i]);
|
||||||
if (getcfg(logbook, str, type, sizeof(type))) {
|
if (getcfg(logbook, str, type, sizeof(type))) {
|
||||||
@ -7505,8 +7498,8 @@ void attrib_from_param(int n_attr, char attrib[MAX_N_ATTR][NAME_LENGTH])
|
|||||||
|
|
||||||
void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL bupload, BOOL breedit)
|
void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL bupload, BOOL breedit)
|
||||||
{
|
{
|
||||||
int i, j, n, index, size, width, height, fh, length, input_size, input_maxlen,
|
int i, j, n, index, aindex, size, width, height, fh, length, input_size, input_maxlen,
|
||||||
format_flags[MAX_N_ATTR], year, month, day, n_attr;
|
format_flags[MAX_N_ATTR], year, month, day, n_attr, n_disp_attr, attr_index[MAX_N_ATTR];
|
||||||
char str[1000], preset[1000], *p, *pend, star[80], comment[10000], reply_string[256],
|
char str[1000], preset[1000], *p, *pend, star[80], comment[10000], reply_string[256],
|
||||||
list[MAX_N_ATTR][NAME_LENGTH], file_name[256], *buffer, format[256], date[80],
|
list[MAX_N_ATTR][NAME_LENGTH], file_name[256], *buffer, format[256], date[80],
|
||||||
attrib[MAX_N_ATTR][NAME_LENGTH], *text, orig_tag[80],
|
attrib[MAX_N_ATTR][NAME_LENGTH], *text, orig_tag[80],
|
||||||
@ -7722,7 +7715,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
rsprintf("{\n");
|
rsprintf("{\n");
|
||||||
|
|
||||||
for (i = 0; i < n_attr; i++) {
|
for (i = 0; i < n_attr; i++) {
|
||||||
if ((attr_flags[i] & AF_REQUIRED) && (attr_flags[i] & AF_HIDDEN) == 0) {
|
if ((attr_flags[i] & AF_REQUIRED)) {
|
||||||
|
|
||||||
/* convert blanks to underscores */
|
/* convert blanks to underscores */
|
||||||
strcpy(ua, attr_list[i]);
|
strcpy(ua, attr_list[i]);
|
||||||
@ -7958,11 +7951,28 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
|
|
||||||
subtable = 0;
|
subtable = 0;
|
||||||
|
|
||||||
/* display attributes */
|
/* generate list of attributes to show */
|
||||||
for (index = 0; index < n_attr; index++) {
|
if (getcfg(lbs->name, "Show attributes", str, sizeof(str))) {
|
||||||
|
n_disp_attr = strbreak(str, list, MAX_N_ATTR, ",");
|
||||||
|
for (i=0 ; i<n_disp_attr ; i++) {
|
||||||
|
for (j=0 ; j<n_attr ; j++)
|
||||||
|
if (strieq(attr_list[j], list[i]))
|
||||||
|
break;
|
||||||
|
if (!strieq(attr_list[j], list[i]))
|
||||||
|
/* attribute not found */
|
||||||
|
j = 0;
|
||||||
|
attr_index[i] = j;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (i=0 ; i<n_attr ; i++)
|
||||||
|
attr_index[i] = i;
|
||||||
|
n_disp_attr = n_attr;
|
||||||
|
}
|
||||||
|
|
||||||
if (attr_flags[index] & AF_HIDDEN)
|
/* display attributes */
|
||||||
continue;
|
for (aindex = 0; aindex < n_disp_attr; aindex++) {
|
||||||
|
|
||||||
|
index = attr_index[aindex];
|
||||||
|
|
||||||
strcpy(class_name, "attribname");
|
strcpy(class_name, "attribname");
|
||||||
strcpy(class_value, "attribvalue");
|
strcpy(class_value, "attribvalue");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user