Added thumbnail display for list display

SVN revision: 1244
This commit is contained in:
Stefan Ritt 2005-03-14 08:36:56 +00:00
parent 458b9affe2
commit 6bd5184ba1

View File

@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG Contents: Web server program for Electronic Logbook ELOG
$Log$ $Log$
Revision 1.585 2005/03/14 08:36:56 ritt
Added thumbnail display for list display
Revision 1.584 2005/03/08 08:51:25 ritt Revision 1.584 2005/03/08 08:51:25 ritt
Fixed bug with resubmit box and conditional attributes Fixed bug with resubmit box and conditional attributes
@ -13378,7 +13381,7 @@ void display_line(LOGBOOK *lbs, int message_id, int number, char *mode,
char attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], char *encoding, char attachment[MAX_ATTACHMENTS][MAX_PATH_LENGTH], char *encoding,
BOOL select, int *n_display, char *locked_by, int highlight, regex_t * re_buf) BOOL select, int *n_display, char *locked_by, int highlight, regex_t * re_buf)
{ {
char str[NAME_LENGTH], ref[256], *nowrap, sclass[80], format[256], char str[NAME_LENGTH], ref[256], thumb_name[256], *nowrap, sclass[80], format[256],
file_name[MAX_PATH_LENGTH], *slist, *svalue; file_name[MAX_PATH_LENGTH], *slist, *svalue;
char display[NAME_LENGTH], attr_icon[80]; char display[NAME_LENGTH], attr_icon[80];
int i, j, i_line, index, colspan; int i, j, i_line, index, colspan;
@ -13819,9 +13822,25 @@ void display_line(LOGBOOK *lbs, int message_id, int number, char *mode,
sprintf(ref, "../%s/%s/%s", lbs->name, str, attachment[index] + 14); sprintf(ref, "../%s/%s/%s", lbs->name, str, attachment[index] + 14);
url_encode(ref, sizeof(ref)); /* for file names with special characters like "+" */ url_encode(ref, sizeof(ref)); /* for file names with special characters like "+" */
strlcpy(thumb_name, lbs->data_dir, sizeof(thumb_name));
strlcat(thumb_name, attachment[index], sizeof(thumb_name));
strlcat(thumb_name, ".thumb", sizeof(thumb_name));
if (!show_attachments) { if (!show_attachments) {
rsprintf("<a href=\"%s\">%s</a>&nbsp;&nbsp;&nbsp;&nbsp; ", ref, attachment[index] + 14); rsprintf("<a href=\"%s\">%s</a>&nbsp;&nbsp;&nbsp;&nbsp; ", ref, attachment[index] + 14);
} else { } else {
if (file_exist(thumb_name)) {
rsprintf
("<tr><td colspan=%d class=\"attachment\">%s %d: <a href=\"%s\">%s</a>\n",
colspan, loc("Attachment"), index + 1, ref, attachment[index] + 14);
if (show_attachments) {
rsprintf("<tr><td colspan=%d class=\"attachmentframe\">\n", colspan);
rsprintf("<a name=\"att%d\" href=\"%s\">\n", index + 1, ref);
rsprintf("<img src=\"%s.thumb\" alt=\"%s\"></a>\n", ref, attachment[index]+14);
rsprintf("</td></tr>\n\n");
}
} else {
if (is_image(attachment[index])) { if (is_image(attachment[index])) {
rsprintf rsprintf
("<tr><td colspan=%d class=\"attachment\">%s %d: <a href=\"%s\">%s</a>\n", ("<tr><td colspan=%d class=\"attachment\">%s %d: <a href=\"%s\">%s</a>\n",
@ -13868,6 +13887,7 @@ void display_line(LOGBOOK *lbs, int message_id, int number, char *mode,
} }
} }
} }
}
if (!show_attachments && attachment[0][0]) if (!show_attachments && attachment[0][0])
rsprintf("</td></tr>\n"); rsprintf("</td></tr>\n");