diff --git a/elogd.c b/elogd.c index 6b0669ed..fb3d7413 100755 --- a/elogd.c +++ b/elogd.c @@ -6,6 +6,9 @@ Contents: Web server program for Electronic Logbook ELOG $Log$ + Revision 2.2 2002/06/07 11:58:43 midas + 'Display search' can now supress display of '#', 'Logbook' and 'Date' + Revision 2.1 2002/06/07 09:37:02 midas Added 'HTML default = 3' @@ -4138,14 +4141,14 @@ void show_elog_submit_find(LOGBOOK *lbs, INT past_n, INT last_n) int i, j, n, size, status, d1, m1, y1, d2, m2, y2, index, colspan, i_line, n_line, i_col; int current_year, current_month, current_day, printable, n_logbook, lindex, n_attr, reverse, n_attr_disp, n_found, search_all, message_id; -char date[80], attrib[MAX_N_ATTR][NAME_LENGTH], disp_attr[MAX_N_ATTR][NAME_LENGTH], +char date[80], attrib[MAX_N_ATTR][NAME_LENGTH], disp_attr[MAX_N_ATTR+4][NAME_LENGTH], list[10000], text[TEXT_SIZE], text1[TEXT_SIZE], text2[TEXT_SIZE], in_reply_to[80], reply_to[256], attachment[MAX_ATTACHMENTS][256], encoding[80]; char str[256], ref[256], file_name[256], col[80]; char *nowrap, format[80]; char menu_str[1000], menu_item[MAX_N_LIST][NAME_LENGTH]; char *p , *pt, *pt1, *pt2; -BOOL full, show_attachments; +BOOL full, show_attachments, link_displayed; time_t ltime, ltime_start, ltime_end, ltime_current, now; struct tm tms, *ptms; FILE *f; @@ -4517,19 +4520,42 @@ FILE *f; size = printable ? 2 : 3; - rsprintf("#", col, size); - - if (search_all) - rsprintf("Logbook", col, size); - - rsprintf("Date", col, size); - if (getcfg(lbs->name, "Display search", list)) n_attr_disp = strbreak(list, disp_attr, MAX_N_ATTR); else { - n_attr_disp = n_attr; - memcpy(disp_attr, attr_list, sizeof(attr_list)); + if (search_all) + { + n_attr_disp = n_attr + 3; + + strcpy(disp_attr[0], "#"); + strcpy(disp_attr[1], "Logbook"); + strcpy(disp_attr[2], "Date"); + memcpy(disp_attr+3, attr_list, sizeof(attr_list)); + } + else + { + n_attr_disp = n_attr + 2; + + strcpy(disp_attr[0], "#"); + strcpy(disp_attr[1], "Date"); + memcpy(disp_attr+2, attr_list, sizeof(attr_list)); + } + } + + for (i=0 ; i#", + col, size); + + if (equal_ustring(disp_attr[i], "Logbook")) + rsprintf("Logbook", + col, size); + + if (equal_ustring(disp_attr[i], "Date")) + rsprintf("Date", + col, size); } for (i=0 ; iname_enc, message_id); - if (full) + if (!full) { + if (i_col % 2 == 0) + strcpy(col, gt("List bgcolor1")); + else + strcpy(col, gt("List bgcolor2")); + i_col++; + } + else strcpy(col, gt("List bgcolor1")); - rsprintf(""); + rsprintf(""); - size = printable ? 2 : 3; - nowrap = printable ? "" : "nowrap"; + size = printable ? 2 : 3; + nowrap = printable ? "" : "nowrap"; + link_displayed = FALSE; + for (j=0 ; j  %d  ", col, size, ref, n_found); + link_displayed = TRUE; + } - if (search_all) + for (j=0 ; j%s", + nowrap, col, size, ref, lbs->name); + link_displayed = TRUE; + } + else rsprintf("%s", nowrap, col, size, lbs->name); + } + for (j=0 ; jname, "Date format", format)) { struct tm ts; @@ -4817,48 +4878,84 @@ FILE *f; else strcpy(str, date); - rsprintf("%s", nowrap, col, size, str); - - for (i=0 ; i%s", + nowrap, col, size, ref, str); + link_displayed = TRUE; + } + else + rsprintf("%s", nowrap, col, size, str); + } - if (j == n_attr_disp) - continue; + for (i=0 ; i\n", col); - else - rsprintf("\n", col); - } - - else if (attr_flags[i] & AF_ICON) - { - rsprintf("", col); - if (attrib[i][0]) - rsprintf("", attrib[i]); - rsprintf(" "); - } + if (j == n_attr_disp) + continue; + if (equal_ustring(attr_options[i][0], "boolean")) + { + if (atoi(attrib[i]) == 1) + rsprintf("\n", col); else - { - rsprintf("", col, size); - rsputs2(attrib[i]); - rsprintf(" "); - } + rsprintf("\n", col); } - rsprintf("\n"); + else if (attr_flags[i] & AF_ICON) + { + rsprintf("", col); + if (attrib[i][0]) + rsprintf("", attrib[i]); + rsprintf(" "); + } - if (search_all) - colspan = 3+n_attr_disp; else - colspan = 2+n_attr_disp; + { + rsprintf("", col, size); + if (!link_displayed) + { + rsprintf("", ref); + rsputs2(attrib[i]); + rsprintf(""); + link_displayed = TRUE; + } + else + rsputs2(attrib[i]); + rsprintf(" "); + } + } + if (!full && n_line > 0) + { + rsprintf("", col, size); + for (i=i_line=0 ; i\n"); + } + + rsprintf("\n"); + + colspan = n_attr_disp; + + if (full) + { if (!getcfg(lbs->name, "Show text", str) || atoi(str) == 1) { rsprintf("", colspan, size); @@ -4952,103 +5049,6 @@ FILE *f; if (!show_attachments && attachment[0][0]) rsprintf("\n"); - - } - else /* if (full) */ - { - if (i_col % 2 == 0) - strcpy(col, gt("List bgcolor1")); - else - strcpy(col, gt("List bgcolor2")); - i_col++; - - rsprintf(""); - - size = printable ? 2 : 3; - nowrap = printable ? "" : "nowrap"; - - rsprintf("  %d  ", - col, size, ref, n_found); - - if (search_all) - rsprintf("%s", nowrap, col, lbs->name); - - if (getcfg(lbs->name, "Date format", format)) - { - struct tm ts; - - memset(&ts, 0, sizeof(ts)); - - for (i=0 ; i<12 ; i++) - if (strncmp(date+4, mname[i], 3) == 0) - break; - ts.tm_mon = i; - - ts.tm_mday = atoi(date+8); - ts.tm_hour = atoi(date+11); - ts.tm_min = atoi(date+14); - ts.tm_sec = atoi(date+17); - ts.tm_year = atoi(date+20)-1900; - - mktime(&ts); - strftime(str, sizeof(str), format, &ts); - } - else - strcpy(str, date); - - rsprintf("%s", nowrap, col, size, str); - - for (i=0 ; i\n", col); - else - rsprintf("\n", col); - } - - else if (attr_flags[i] & AF_ICON) - { - rsprintf("", col); - if (attrib[i][0]) - rsprintf("", attrib[i]); - rsprintf(" "); - } - - else - rsprintf("%s ", col, size, attrib[i]); - } - - if (n_line > 0) - { - rsprintf("", col, size); - for (i=i_line=0 ; i\n"); - } - - rsprintf("\n"); } }