mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-10 18:23:28 +00:00
Fixed display of inline images and truncated ASCII attachments in list mode
SVN revision: 2072
This commit is contained in:
parent
9a32c4e589
commit
363fc8c5e2
42
src/elogd.c
42
src/elogd.c
@ -16455,7 +16455,8 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
|
|||||||
char str[NAME_LENGTH], ref[256], *nowrap, sclass[80], format[256],
|
char str[NAME_LENGTH], ref[256], *nowrap, sclass[80], format[256],
|
||||||
file_name[MAX_PATH_LENGTH], *slist, *svalue, comment[256];
|
file_name[MAX_PATH_LENGTH], *slist, *svalue, comment[256];
|
||||||
char display[NAME_LENGTH], attr_icon[80];
|
char display[NAME_LENGTH], attr_icon[80];
|
||||||
int i, j, i_line, index, colspan, n_attachments, line_len, thumb_status, max_line_len;
|
int i, j, i_line, index, colspan, n_attachments, line_len, thumb_status, max_line_len, n_lines,
|
||||||
|
max_n_lines;
|
||||||
BOOL skip_comma;
|
BOOL skip_comma;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
struct tm *pts;
|
struct tm *pts;
|
||||||
@ -17034,8 +17035,7 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
|
|||||||
if (show_attachments && attachment[index][0]) {
|
if (show_attachments && attachment[index][0]) {
|
||||||
|
|
||||||
/* check if attachment is inlined */
|
/* check if attachment is inlined */
|
||||||
sprintf(str, "[img]elog:/%d[/img]", index + 1);
|
if (is_inline_attachment(encoding, message_id, text, index, attachment[index]))
|
||||||
if (strieq(encoding, "ELCode") && stristr(text, str))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
strlcpy(str, attachment[index], sizeof(str));
|
strlcpy(str, attachment[index], sizeof(str));
|
||||||
@ -17117,23 +17117,53 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
|
|||||||
!chkext(attachment[index], ".HTM") &&
|
!chkext(attachment[index], ".HTM") &&
|
||||||
!chkext(attachment[index], ".HTML") && show_attachments) {
|
!chkext(attachment[index], ".HTML") && show_attachments) {
|
||||||
|
|
||||||
|
rsprintf("</td></tr>\n");
|
||||||
|
|
||||||
/* display attachment */
|
/* display attachment */
|
||||||
rsprintf("</td></tr><tr><td colspan=%d class=\"messagelist\"><pre>", colspan);
|
rsprintf("<tr><td colspan=%d class=\"messageframe\">\n", colspan);
|
||||||
|
|
||||||
|
/* anchor for references */
|
||||||
|
rsprintf("<a name=\"att%d\"></a>\n", index + 1);
|
||||||
|
|
||||||
|
/* display attachment */
|
||||||
|
|
||||||
|
if (!chkext(attachment[index], ".HTML"))
|
||||||
|
rsprintf("<pre class=\"messagepre\">");
|
||||||
|
|
||||||
strlcpy(file_name, lbs->data_dir, sizeof(file_name));
|
strlcpy(file_name, lbs->data_dir, sizeof(file_name));
|
||||||
strlcat(file_name, attachment[index], sizeof(file_name));
|
strlcat(file_name, attachment[index], sizeof(file_name));
|
||||||
|
|
||||||
f = fopen(file_name, "rt");
|
f = fopen(file_name, "rt");
|
||||||
|
|
||||||
|
n_lines = 0;
|
||||||
|
if (getcfg(lbs->name, "Attachment lines", str, sizeof(str)))
|
||||||
|
max_n_lines = atoi(str);
|
||||||
|
else
|
||||||
|
max_n_lines = 300;
|
||||||
|
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
while (!feof(f)) {
|
while (!feof(f)) {
|
||||||
str[0] = 0;
|
str[0] = 0;
|
||||||
fgets(str, sizeof(str), f);
|
fgets(str, sizeof(str), f);
|
||||||
rsputs2(lbs, absolute_link, str);
|
|
||||||
|
if (n_lines < max_n_lines) {
|
||||||
|
if (!chkext(attachment[index], ".HTML"))
|
||||||
|
rsputs2(lbs, absolute_link, str);
|
||||||
|
else
|
||||||
|
rsputs(str);
|
||||||
|
}
|
||||||
|
n_lines++;
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
rsprintf("</pre>\n");
|
if (!chkext(attachment[index], ".HTML"))
|
||||||
|
rsprintf("</pre>");
|
||||||
|
rsprintf("\n");
|
||||||
|
if (max_n_lines == 0)
|
||||||
|
rsprintf("<i><b>%d lines</b></i>\n", n_lines);
|
||||||
|
else if (n_lines > max_n_lines)
|
||||||
|
rsprintf("<i><b>... %d more lines ...</b></i>\n", n_lines - max_n_lines);
|
||||||
}
|
}
|
||||||
rsprintf("</td></tr>\n");
|
rsprintf("</td></tr>\n");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user