mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Started adding attachment hiding
SVN revision: 1049
This commit is contained in:
parent
cd46e08f59
commit
3e29c286e2
38
src/elogd.c
38
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.452 2004/08/08 20:30:10 midas
|
||||||
|
Started adding attachment hiding
|
||||||
|
|
||||||
Revision 1.451 2004/08/08 16:00:34 midas
|
Revision 1.451 2004/08/08 16:00:34 midas
|
||||||
Renamed logf() to write_logfile()
|
Renamed logf() to write_logfile()
|
||||||
|
|
||||||
@ -16638,8 +16641,8 @@ void copy_to(LOGBOOK * lbs, int src_id, char *dest_logbook, int move, int orig_i
|
|||||||
|
|
||||||
void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
|
void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
|
||||||
{
|
{
|
||||||
int size, i, j, n, n_log, status, fh, length, message_error, index;
|
int size, i, j, n, n_log, status, fh, length, message_error, index,
|
||||||
int message_id, orig_message_id, format_flags[MAX_N_ATTR];
|
message_id, orig_message_id, format_flags[MAX_N_ATTR], att_hide[MAX_ATTACHMENTS];
|
||||||
char str[1000], ref[256], file_name[256], attrib[MAX_N_ATTR][NAME_LENGTH];
|
char str[1000], ref[256], file_name[256], attrib[MAX_N_ATTR][NAME_LENGTH];
|
||||||
char date[80], text[TEXT_SIZE], menu_str[1000], cmd[256], cmd_enc[256],
|
char date[80], text[TEXT_SIZE], menu_str[1000], cmd[256], cmd_enc[256],
|
||||||
orig_tag[80], reply_tag[MAX_REPLY_TO * 10], display[256],
|
orig_tag[80], reply_tag[MAX_REPLY_TO * 10], display[256],
|
||||||
@ -17276,6 +17279,19 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
|
|||||||
|
|
||||||
rsputs("</td></tr>\n");
|
rsputs("</td></tr>\n");
|
||||||
|
|
||||||
|
for (i=0 ; i<MAX_ATTACHMENTS; i++)
|
||||||
|
att_hide[i] = 0;
|
||||||
|
|
||||||
|
if (isparam("hide")) {
|
||||||
|
strlcpy(str, getparam("hide"), sizeof(str));
|
||||||
|
p = strtok(str, ",");
|
||||||
|
while (p != NULL) {
|
||||||
|
if (atoi(p) < MAX_ATTACHMENTS)
|
||||||
|
att_hide[atoi(p)] = 1;
|
||||||
|
p = strtok(NULL, ",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (index = 0; index < MAX_ATTACHMENTS; index++) {
|
for (index = 0; index < MAX_ATTACHMENTS; index++) {
|
||||||
if (attachment[index][0] && strlen(attachment[index]) > 14) {
|
if (attachment[index][0] && strlen(attachment[index]) > 14) {
|
||||||
for (i = 0; i < (int) strlen(attachment[index]); i++)
|
for (i = 0; i < (int) strlen(attachment[index]); i++)
|
||||||
@ -17318,8 +17334,18 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
|
|||||||
rsprintf("%d kB", length / 1024);
|
rsprintf("%d kB", length / 1024);
|
||||||
else
|
else
|
||||||
rsprintf("%1.3lf MB", length / 1024.0 / 1024.0);
|
rsprintf("%1.3lf MB", length / 1024.0 / 1024.0);
|
||||||
|
rsprintf("</span>\n");
|
||||||
|
|
||||||
rsprintf("</span></td></tr></table></td></tr>\n");
|
/*
|
||||||
|
rsprintf(" | <span class=\"bytes\">");
|
||||||
|
rsprintf("<a href=\"%d?hide=%s\">%s</a>", message_id, "##", loc("Hide"));
|
||||||
|
rsprintf("<a href=\"%d?hide=%s\">%s</a>", message_id, loc("Hide all"));
|
||||||
|
rsprintf("</span>\n");
|
||||||
|
*/
|
||||||
|
|
||||||
|
rsprintf("</td></tr></table></td></tr>\n");
|
||||||
|
strlcpy(file_name, lbs->data_dir, sizeof(file_name));
|
||||||
|
strlcat(file_name, attachment[index], sizeof(file_name));
|
||||||
|
|
||||||
if (!getcfg(lbs->name, "Show attachments", str, sizeof(str))
|
if (!getcfg(lbs->name, "Show attachments", str, sizeof(str))
|
||||||
|| atoi(str) == 1) {
|
|| atoi(str) == 1) {
|
||||||
@ -17330,8 +17356,7 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
|
|||||||
rsprintf("<img src=\"%s\"></td></tr>", ref);
|
rsprintf("<img src=\"%s\"></td></tr>", ref);
|
||||||
rsprintf("</td></tr>\n\n");
|
rsprintf("</td></tr>\n\n");
|
||||||
} else {
|
} else {
|
||||||
if (strstr(att, ".TXT") || strstr(att, ".ASC") || strstr(att, ".CFG") || strstr(att, ".CONF")
|
if (is_ascii(file_name)) {
|
||||||
|| strchr(att, '.') == NULL) {
|
|
||||||
/* display attachment */
|
/* display attachment */
|
||||||
rsprintf("<tr><td class=\"messageframe\">\n");
|
rsprintf("<tr><td class=\"messageframe\">\n");
|
||||||
|
|
||||||
@ -17341,9 +17366,6 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
|
|||||||
if (!strstr(att, ".HTML"))
|
if (!strstr(att, ".HTML"))
|
||||||
rsprintf("<pre class=\"messagepre\">");
|
rsprintf("<pre class=\"messagepre\">");
|
||||||
|
|
||||||
strlcpy(file_name, lbs->data_dir, sizeof(file_name));
|
|
||||||
strlcat(file_name, attachment[index], sizeof(file_name));
|
|
||||||
|
|
||||||
f = fopen(file_name, "rt");
|
f = fopen(file_name, "rt");
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
while (!feof(f)) {
|
while (!feof(f)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user