mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Fixed bug with quick date filter and threaded display
SVN revision: 2290
This commit is contained in:
parent
2ecc716236
commit
dcf072454b
23
src/elogd.c
23
src/elogd.c
@ -19022,8 +19022,9 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa
|
|||||||
mid[80], menu_str[1000], menu_item[MAX_N_LIST][NAME_LENGTH], param[NAME_LENGTH], format[80],
|
mid[80], menu_str[1000], menu_item[MAX_N_LIST][NAME_LENGTH], param[NAME_LENGTH], format[80],
|
||||||
sort_attr[MAX_N_ATTR + 4][NAME_LENGTH], mode_cookie[80], charset[25], sort_item[NAME_LENGTH];
|
sort_attr[MAX_N_ATTR + 4][NAME_LENGTH], mode_cookie[80], charset[25], sort_item[NAME_LENGTH];
|
||||||
char *p, *pt1, *pt2, *slist, *svalue, *gattr, line[1024], iattr[256];
|
char *p, *pt1, *pt2, *slist, *svalue, *gattr, line[1024], iattr[256];
|
||||||
BOOL show_attachments, threaded, csv, xml, raw, mode_commands, expand, filtering, disp_filter, show_text,
|
BOOL show_attachments, threaded, csv, xml, raw, mode_commands, expand, filtering, date_filtering,
|
||||||
text_in_attr, searched, found, disp_attr_link[MAX_N_ATTR + 4], sort_attributes, show_att_column;
|
disp_filter, show_text, text_in_attr, searched, found, disp_attr_link[MAX_N_ATTR + 4],
|
||||||
|
sort_attributes, show_att_column;
|
||||||
time_t ltime, ltime_start, ltime_end, now, ltime1, ltime2, entry_ltime;
|
time_t ltime, ltime_start, ltime_end, now, ltime1, ltime2, entry_ltime;
|
||||||
struct tm tms, *ptms;
|
struct tm tms, *ptms;
|
||||||
MSG_LIST *msg_list;
|
MSG_LIST *msg_list;
|
||||||
@ -19374,29 +19375,35 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa
|
|||||||
|
|
||||||
/*---- apply start/end date cut ----*/
|
/*---- apply start/end date cut ----*/
|
||||||
|
|
||||||
|
date_filtering = FALSE;
|
||||||
|
|
||||||
if (past_n > 0)
|
if (past_n > 0)
|
||||||
ltime_start = now - 3600 * 24 * past_n; // past n days
|
ltime_start = now - 3600 * 24 * past_n; // past n days
|
||||||
else if (past_n < 0)
|
else if (past_n < 0)
|
||||||
ltime_start = now + 3600 * past_n; // past n hours
|
ltime_start = now + 3600 * past_n; // past n hours
|
||||||
|
|
||||||
if (last_n && last_n < n_msg) {
|
if (last_n && last_n < n_msg) {
|
||||||
|
date_filtering = TRUE;
|
||||||
for (i = n_msg - last_n - 1; i >= 0; i--)
|
for (i = n_msg - last_n - 1; i >= 0; i--)
|
||||||
msg_list[i].lbs = NULL;
|
msg_list[i].lbs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ltime_start) {
|
if (ltime_start) {
|
||||||
|
date_filtering = TRUE;
|
||||||
for (i = 0; i < n_msg; i++)
|
for (i = 0; i < n_msg; i++)
|
||||||
if (msg_list[i].lbs && msg_list[i].lbs->el_index[msg_list[i].index].file_time < ltime_start)
|
if (msg_list[i].lbs && msg_list[i].lbs->el_index[msg_list[i].index].file_time < ltime_start)
|
||||||
msg_list[i].lbs = NULL;
|
msg_list[i].lbs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ltime_end) {
|
if (ltime_end) {
|
||||||
|
date_filtering = TRUE;
|
||||||
for (i = 0; i < n_msg; i++)
|
for (i = 0; i < n_msg; i++)
|
||||||
if (msg_list[i].lbs && msg_list[i].lbs->el_index[msg_list[i].index].file_time > ltime_end)
|
if (msg_list[i].lbs && msg_list[i].lbs->el_index[msg_list[i].index].file_time > ltime_end)
|
||||||
msg_list[i].lbs = NULL;
|
msg_list[i].lbs = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isparam("last")) {
|
if (isparam("last")) {
|
||||||
|
date_filtering = TRUE;
|
||||||
n = atoi(getparam("last"));
|
n = atoi(getparam("last"));
|
||||||
|
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
@ -19770,7 +19777,7 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa
|
|||||||
|
|
||||||
/*---- in threaded mode, set date of latest entry of thread ----*/
|
/*---- in threaded mode, set date of latest entry of thread ----*/
|
||||||
|
|
||||||
if (threaded && !filtering) {
|
if (threaded && !filtering && !date_filtering) {
|
||||||
for (index = 0; index < n_msg; index++) {
|
for (index = 0; index < n_msg; index++) {
|
||||||
if (!msg_list[index].lbs)
|
if (!msg_list[index].lbs)
|
||||||
continue;
|
continue;
|
||||||
@ -20734,8 +20741,8 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa
|
|||||||
expand = atoi(getparam("expand"));
|
expand = atoi(getparam("expand"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filtering) {
|
level = 0;
|
||||||
level = 0;
|
if (!filtering && !date_filtering) {
|
||||||
if (expand == 0 && (!getcfg(lbs->name, "Collapse to last", str, sizeof(str)) || atoi(str) == 1)) {
|
if (expand == 0 && (!getcfg(lbs->name, "Collapse to last", str, sizeof(str)) || atoi(str) == 1)) {
|
||||||
/* search last entry in this thread */
|
/* search last entry in this thread */
|
||||||
if (reply_to[0]) {
|
if (reply_to[0]) {
|
||||||
@ -20748,7 +20755,9 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa
|
|||||||
level = 1;
|
level = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
|
if (in_reply_to[0])
|
||||||
|
level = 1;
|
||||||
|
|
||||||
display_line(msg_list[index].lbs, message_id, index, mode, expand, level, printable, n_line,
|
display_line(msg_list[index].lbs, message_id, index, mode, expand, level, printable, n_line,
|
||||||
show_attachments, show_att_column, date, in_reply_to, reply_to, n_attr_disp, disp_attr,
|
show_attachments, show_att_column, date, in_reply_to, reply_to, n_attr_disp, disp_attr,
|
||||||
@ -20756,7 +20765,7 @@ void show_elog_list(LOGBOOK * lbs, int past_n, int last_n, int page_n, BOOL defa
|
|||||||
isparam("select") ? atoi(getparam("select")) : 0, &n_display, locked_by, 0, re_buf,
|
isparam("select") ? atoi(getparam("select")) : 0, &n_display, locked_by, 0, re_buf,
|
||||||
page_mid, FALSE);
|
page_mid, FALSE);
|
||||||
|
|
||||||
if (threaded && !filtering) {
|
if (threaded && !filtering && !date_filtering) {
|
||||||
if (reply_to[0] && expand > 0) {
|
if (reply_to[0] && expand > 0) {
|
||||||
p = reply_to;
|
p = reply_to;
|
||||||
do {
|
do {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user